import hashlib
from fontcolor import fontcolor_change as font
# from Everyday_Job._7_10md5密码 import class_user_word_is_True as ising
class Register:

    # dict1 = {}

    def __init__(self,username,password):
        self.username = username
        self.password = password

    def record_md5_usernamefile(self):

        md5 = hashlib.md5()
        md5.update(self.username.encode('utf8'))
        md5_username = md5.hexdigest()

        with open('record_md5.txt','a',encoding='utf8') as record_md5:
            record_md5.write(md5_username)

    def record_md5_passwordfile(self):
        md5 = hashlib.md5()
        md5.update(self.password.encode('utf8'))
        md5_password = md5.hexdigest()

        with open('record_md5.txt','a',encoding='utf8') as record_md5:
            record_md5.write(md5_password)

    def __str__(self):
        return '用户名：{},密码：{}'.format(self.username,self.password)

    @staticmethod
    def show():
        print('Wlecome to Register !')

while 1:
    username = input('请输入要注册的用户名：')
    password = input('请输入要注册的密码：')
    register = Register(username,password)
    register.show()
    register.record_md5_usernamefile()
    register.record_md5_passwordfile()
    print(font.Ok+'加载成功')
    break
# while 1:
#     print('Wlecome to 登录界面！')
#     entername = input('请输入您的用户名：')
#     enterpassword = input('请输入密码：')
#     true_false = ising.regiest_enter_is_TrueorFalse(entername,enterpassword)
#     with open('true_or_false.txt', 'a', encoding='utf8') as record_md5:
#         record_md5.write(true_false.ising_entername())
#     with open('true_or_false.txt', 'a', encoding='utf8') as record_md5:
#         record_md5.write(true_false.ising_enterword())
#     with open('record_md5.txt','r',encoding='utf8') as reading_record:
#         reading_record_md5 = reading_record.read()
#     with open('true_or_false.txt', 'r', encoding='utf8') as reading_true_or_false:
#         reading_true_or_false_md5 = reading_true_or_false.read()
#         if reading_record_md5 == reading_true_or_false_md5:
#             print('登录成功 ~--~')
#         else:
#             print('用户名或密码错误！')









